package com.hulk.ratel.web.interceptor;

import com.hulk.common.util.JsonMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.annotation.Order;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
* @author cmt  
* @E-mail:29572320@qq.com
* @version Create on:  2017年4月12日 下午2:18:39
* Class description
*/

@Order(2)
public class RateLimitInterceptor extends HandlerInterceptorAdapter {

    private static final Logger log = LoggerFactory.getLogger(RateLimitInterceptor.class);
    private static JsonMapper json = JsonMapper.JSON_NON_DEFAULT_MAPPER;

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
            throws Exception {

       log.debug("RateLimitInterceptor.postHandle");
        return super.preHandle(request, response, handler);
    }

    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
                           ModelAndView modelAndView) throws Exception {
        log.debug("RateLimitInterceptor.postHandle");
    }

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
            throws Exception {
        log.debug("RateLimitInterceptor.afterCompletion", ex);
    }

}
